<?php

namespace app\open\controller;

use app\common\controller\OpenApi;

/**
 * 授权
 */
class Token extends OpenApi
{

    protected $noNeedLogin = ['index'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];

    public function index()
    {
        $appid = $this->request->request('appid');
        $serect = $this->request->request('serect');

        if (!$appid || !$serect) {
            $this->error('参数有误');
        }

        $data = $this->auth->login($appid, $serect);

        if (!$data) {
            $this->error($this->auth->getError());
        }

        $this->success('', $this->auth->getUserInfo());
    }


}
